<?php
/**
* $Id: shared_object.php 12 2010-11-28 20:02:53Z LEON $
* $Author: LEON $
* $LastChangedDate: 2010-11-28 20:02:53 +0000 (Sun, 28 Nov 2010) $
* $Revision: 12 $
*/
//TODO: Переписать систему "шаред объектов"
namespace cmFly\system;
class shared_object {
    protected static $layers=Array();
    protected static $global_keys=Array();
    protected $keys=Array();
    public function set_global($key,$value) {
	self::$global_keys[$key]=$value;
    }
    public function set_key($key,$value) {
	$this->keys[$key]=$value;
    }
    public function get_global($key) {
	return @self::$global_keys[$key];
    }
    public function get_key($key) {
	return @$this->keys[$key];
    }
    /**
     *
     * @param string $layer
     * @return shared_object
     */
    public function layer($layer) {
	if(!isset(self::$layers[$layer])) {
	    self::$layers[$layer]=new self();
	}
	return self::$layers[$layer];
    }
}